//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.HtmlControls;

using CommunityServer.Components;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls 
{

	public class RssLink : BaseRssLink
	{
		protected override bool IsInvalid()
		{
			return (csContext.SectionID < 1);
		}

		protected override bool IsAvailableToPublic()
		{

			return Permissions.ValidatePermissions(Forums.GetForum(csContext.SectionID), Permission.Read, Users.GetAnonymousUser(true));
		}

		protected override string Url
		{
			get { return ForumUrls.Instance().RssForum(csContext.SectionID, this.Mode); }
		}

		[System.ComponentModel.DefaultValue(ThreadViewMode.Default)]
		public virtual ThreadViewMode Mode
		{
			get
			{
				Object state = ViewState["Mode"];
				if (state != null)
				{
					return (ThreadViewMode)state;
				}

				return ThreadViewMode.Default;
			}
			set { ViewState["Mode"] = value; }
		}

        protected override void SetRssAutoDiscovery()
        {
            SetRssAutoDiscovery(Forums.GetForum(csContext.SectionID).Name,base.HRef);
        }

	}
}


